Socket
Socket
Sign inDemoInstall

@thi.ng/api

Package Overview
Dependencies
Maintainers
0
Versions
185
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/api

Common, generic types, interfaces & mixins


Version published
Weekly downloads
132K
decreased by-0.46%
Maintainers
0
Weekly downloads
 
Created

What is @thi.ng/api?

@thi.ng/api is a collection of TypeScript interfaces, types, and utility functions for functional programming, event handling, and other common tasks in JavaScript/TypeScript projects.

What are @thi.ng/api's main functionalities?

Event Handling

This feature allows you to create and manage custom events. The code sample demonstrates creating an event, adding a listener, and dispatching the event.

const { Event } = require('@thi.ng/api');

const event = new Event('test');
event.addListener('test', (e) => console.log('Event received:', e));
event.dispatch('test', { message: 'Hello, World!' });

Functional Programming Utilities

This feature provides utility functions for functional programming. The code sample demonstrates filtering an array to get even numbers and then mapping the array to get their squares.

const { map, filter } = require('@thi.ng/api');

const nums = [1, 2, 3, 4, 5];
const evenNums = filter((x) => x % 2 === 0, nums);
const squaredNums = map((x) => x * x, evenNums);
console.log(squaredNums); // [4, 16]

Type Utilities

This feature includes type-checking utilities. The code sample demonstrates checking if a value is a string or a number.

const { isString, isNumber } = require('@thi.ng/api');

console.log(isString('hello')); // true
console.log(isNumber(123)); // true
console.log(isNumber('123')); // false

Other packages similar to @thi.ng/api

Keywords

FAQs

Package last updated on 18 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc